<!--26-DOM-createElement.html-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>DOM-createElement</title>
    <script type="text/javascript">
        window.onload = function () {
            var divObj = document.createElement("div");  // <div></div>
            var text = document.createTextNode("ylaihui.com");  // 创建文本对象 "ylaihui"
            divObj.appendChild(text);  // <div>ylaihui</div>

            // 另一种方式
            var divObj1 = document.createElement("div");
            divObj1.innerHTML = "www.ylaihui.com";

            document.body.appendChild(divObj);  // <body></body>中添加子元素 <div>ylaihui</div>
            document.body.appendChild(divObj1);
        }
    </script>
</head>
<body>

</body>
</html>